﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace FastFoodToNight.Models
{
    public class CartItem
    {
        public System.DateTime DateCreated { get; set; }
        public string tensanpham { get; set; }
        public int soluong { get; set; }
        public string mota {
            get { return sanpham.mota; }
             }
        private SanPham _sanpham = null;
        public int masanpham { get; set; }
        private SanPham sanpham
        {
            get
            {
                if (_sanpham == null)
                {
                    _sanpham = new SanPham(masanpham);
                }
                return _sanpham;
            }
        }
        public Nullable<double> dongia
        { 
            get
                { 
                return sanpham.dongia;
                }
        }
        public Nullable<double> tongtien 
        {
            get { return dongia * soluong; }
        }
         }
        //public CartItem()
        //{
            
        //}
        //public  CartItem(int id)
        //{
        //    this.masanpham =id;
        //}
        //public bool Equals(CartItem item)
        //{
        //    return item.masanpham == this.masanpham;
        //}
    }
